﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ElFinder.Connector.Utils;
namespace ElFinder.Connector.Commands
{
    public class Read : ICommand
    {
        public string Target { get; set; }

        public string Current { get; set; }

        public Read(string current, string target)
        {
            this.Target = target;
            this.Current = current;            
        }

        #region ICommand Members       

        public ElFinder.Connector.Responses.Response Execute()
        {
            var toRead = DirectoryUtils.GetFilePathByHash(Target);

            var content = System.IO.File.ReadAllText(toRead);

            var response = new Responses.FileResponse();

            response.content = content;

            return response;
        }

        #endregion
    }
}
